<template>
  <LoginHeader>联合登录</LoginHeader>
  <section class="container">
    <!-- 标签页 -->
    <nav class="tab">
      <a
        @click="changeTab(true)"
        href="javascript:;"
        :class="{ active: hasAccount }"
      >
        <i class="iconfont icon-bind" />
        <span>已有小兔鲜账号，请绑定手机</span>
      </a>
      <a
        @click="changeTab(false)"
        href="javascript:;"
        :class="{ active: !hasAccount }"
      >
        <i class="iconfont icon-edit" />
        <span>没有小兔鲜账号，请完善资料</span>
      </a>
    </nav>
    <!-- 切换组件 -->
    <div class="tab-content" v-if="hasAccount">
      <!-- 已有小兔鲜儿账号，只用绑定手机=》相当于绑定了qq号 -->
      <BindPhone />
    </div>
    <div class="tab-content" v-else>
      <!-- 没有小兔鲜儿账号=》需要注册小兔仙账号，然后绑定qq号 -->
      <PatchInfo />
    </div>
  </section>
  <LoginFooter />
</template>

<script>
import { ref } from 'vue'
import LoginHeader from './components/login-header'
import LoginFooter from './components/login-footer'
// 导入绑定手机和完善资料组件
import BindPhone from './components/callback-bind.vue'
import PatchInfo from './components/callback-patch.vue'
export default {
  name: 'PageCallback',
  components: { LoginHeader, LoginFooter, BindPhone, PatchInfo },
  setup () {
    // 是否有账号(小兔仙账号)
    const hasAccount = ref(true)

    const changeTab = (has) => {
      hasAccount.value = has
    }
    return { hasAccount, changeTab }
  }
}
</script>

<style scoped lang='less'>
.container {
  padding: 25px 0;
}
.tab {
  background: #fff;
  height: 80px;
  padding-top: 40px;
  font-size: 18px;
  text-align: center;
  a {
    color: #666;
    display: inline-block;
    width: 350px;
    line-height: 40px;
    border-bottom: 2px solid #e4e4e4;
    i {
      font-size: 22px;
      vertical-align: middle;
    }
    span {
      vertical-align: middle;
      margin-left: 4px;
    }
    &.active {
      color: @xtxColor;
      border-color: @xtxColor;
    }
  }
}
.tab-content {
  min-height: 600px;
  background: #fff;
}
</style>
